@import './icon.scss';

.vxp-carousel {
  @include basis;

  position: relative;
  display: inline-flex;
  flex-direction: column;
  width: 100%;
  user-select: none;

  &--vertical {
    flex-direction: row;
    width: auto;
    height: 100%;
  }

  &__list {
    overflow: hidden;
  }

  &__track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: $vxp-transition-transform-base;
  }

  &--vertical &__track {
    flex-direction: column;
  }

  &__item {
    position: relative;
    display: inline-flex;
    padding: 0 10px;
    // transition: $vxp-transition-transform-base;
  }

  &--vertical &__item {
    padding: 10px 0;
  }

  $arrow-padding: 10px;

  &__arrow {
    &--inside,
    &--outside {
      position: relative;
      z-index: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
      user-select: none;
    }

    &--inside {
      position: absolute;
      top: 0;
      bottom: 0;
      opacity: 0;
      transition: $vxp-transition-opacity-base;
    }

    &--prev {
      padding-right: $arrow-padding;
    }

    &--inside#{&}--prev {
      left: 20px;
    }

    &--next {
      padding-left: $arrow-padding;
    }

    &--inside#{&}--next {
      right: 20px;
    }

    &--inside#{&}--show {
      opacity: 1;
    }
  }

  &--vertical &__arrow {
    &--prev {
      padding: 0;
      padding-bottom: $arrow-padding;
    }

    &--next {
      padding: 0;
      padding-top: $arrow-padding;
    }
  }

  &__handler {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: $vxp-color-fill-disabled;
    pointer-events: auto;
    cursor: pointer;
    background-color: rgba($vxp-color-content-normal, 0.45);
    border-radius: 50%;
    transition: $vxp-transition-background-base, $vxp-transition-opacity-base;

    .vxp-icon {
      color: $vxp-color-fill-disabled;
    }

    &:hover {
      background-color: rgba($vxp-color-content-normal, 0.7);

      .vxp-icon {
        color: $vxp-color-fill;
      }
    }

    &--disabled {
      cursor: not-allowed;

      &,
      &:hover {
        background-color: rgba($vxp-color-content-normal, 0.3);

        .vxp-icon {
          color: $vxp-color-fill-disabled;
        }
      }
    }
  }

  /* stylelint-disable */
  &__arrow--inside &__handle-inner {
    opacity: 0;

    &--show {
      opacity: 1;
    }
  }

  // &:hover &__handle-inner {
  //   opacity: 1;
  // }
  /* stylelint-enable */

  &__pointers {
    &--inside,
    &--outside {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 40px;
      pointer-events: none;
    }

    &--none {
      display: none;
    }

    &--inside {
      position: absolute;
      bottom: 0;
      left: 0;
    }

    &--outside {
      padding: 16px;
    }
  }

  &--vertical &__pointers {
    &--inside,
    &--outside {
      flex-direction: column;
      width: 40px;
      height: 100%;
    }

    &--inside {
      right: 0;
      bottom: 0;
      left: auto;
    }
  }

  &__pointer {
    display: flex;
    padding: 3px;
    pointer-events: auto;
    cursor: pointer;

    &-inner {
      display: inline-block;
      width: 16px;
      height: 3px;
      margin: 1px 0 2px;
      background-color: $vxp-color-content-secondary;
      border-radius: $vxp-border-radius-small;
      opacity: 0.4;
      transition: width $vxp-transition-base, $vxp-transition-opacity-base;
    }

    &:hover &-inner {
      opacity: 0.7;
    }

    &--active &-inner {
      width: 24px;
      opacity: 0.7;
    }

    &--disabled {
      cursor: not-allowed;

      &,
      &:hover {
        opacity: 0.2;
      }
    }
  }

  &--vertical &__pointer {
    &-inner {
      width: 3px;
      height: 16px;
      margin: 0 2px 1px 0;
      transition: height $vxp-transition-base, $vxp-transition-opacity-base;
    }

    &--active .vxp-carousel__pointer-inner {
      height: 24px;
    }
  }
}
